package com.base.component.ai.system.service.impl;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.base.component.ai.system.dao.FlowTrackDao;
import com.base.component.ai.system.entity.FlowTrackDO;
import com.base.component.ai.system.service.FlowTrackService;
import com.base.component.ai.workflow.core.NodeHandleLog;
import com.base.component.ai.workflow.node.Node;
import com.base.core.framework.sql.service.impl.SqlBaseServiceImplV1Ext;
import com.gitee.magic.core.json.JsonObject;


/**
 * @author zywei 
 * @date 2025-01-11 11:55:19
 */
@Service("flowTrackService")
public class FlowTrackServiceImpl extends SqlBaseServiceImplV1Ext<FlowTrackDO,Long> 
implements FlowTrackService,NodeHandleLog {

	final FlowTrackDao flowTrackDao;
	
	public FlowTrackServiceImpl(@Qualifier("flowTrackDao")FlowTrackDao flowTrackDao) {
		super(flowTrackDao);
		this.flowTrackDao=flowTrackDao;
	}

	@Override
	public void saveLog(Long flowRunId, Node node, JsonObject data, Long cost) {
		FlowTrackDO track=new FlowTrackDO();
		track.setFlowRunId(flowRunId);
		track.setNodeType(node.getNodeType());
		track.setData(data);
		track.setCost(cost);
		save(track);
	}

}
